﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Utilities.Common
{
    public static class ListExtender
    {
        public static T GetById<T>(this List<T> list, object id) where T:new()
        {
            ClassInfo info=ClassInfoCache.GetClassInfo(new T());
            foreach (T item in list)
            {
                if (info.Properties.PropId.GetValue(item).ToString() == id.ToString())
                {
                    return item;
                } 
            }
            return default(T);
           
        }
    }
}
